﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
//using Oracle.DataAccess.Client;
using System.Configuration;
//using System.Data.Entity.Infrastructure;
using System.ComponentModel.DataAnnotations;
using DslamPort.Models;
using System.Collections.ObjectModel;
using System.Web.Mvc;
using System.Data.OracleClient;
using System.Data;

namespace DslamPort.Models
{
    public class xuatdulieuModel
    {
        public string cong { get; set; }
        public string mathietbi { get; set; }
        public string slot { get; set; }
        public string port { get; set; }
        public string trangthai { get; set; }
        public string vpi { get; set; }
        public string vci { get; set; }
        public string accinternet { get; set; }
        public string accmytv { get; set; }
        public string goicuoc { get; set; }
        public string ip { get; set; }
        public static List<xuatdulieuModel> getDslamPort_4thamso()
        {
            List<xuatdulieuModel> DslamPort = new List<xuatdulieuModel>();
            string sql = "";
            sql = "SELECT b.*,a.ip from dslam a,dslam_port b where a.system_id=b.system_id and( a.dslam_type_id=5 or a.dslam_type_id=4 or a.dslam_type_id=6 ) ORDER BY b.system_id,b.cong";
            var odr = BaseClass.Lib_GetDataReader(sql);
            foreach (DataRow item in odr.Rows)
            {
                DslamPort.Add(new xuatdulieuModel
                {
                    cong = item["cong"].ToString(),
                    mathietbi = item["system_id"].ToString(),
                    slot = item["slot"].ToString(),
                    port = item["port"].ToString(),
                    vpi = item["vpi"].ToString(),
                    vci = item["vci"].ToString(),
                    trangthai = item["status"].ToString(),
                    accinternet = item["account_int"].ToString(),
                    accmytv = item["account_mytv"].ToString(),
                    goicuoc = item["GOIDV_INT"].ToString(),
                    ip = item["ip"].ToString(),

                });
           
            }
            BaseClass.conn_global.Close();
            return DslamPort;
        }



        internal static List<xuatdulieuModel> getDslamPort_7thamso()
        {
            List<xuatdulieuModel> DslamPort = new List<xuatdulieuModel>();
            string sql = "";
            sql = "SELECT b.* from dslam a,dslam_port b where a.system_id=b.system_id and( a.dslam_type_id=1 or a.dslam_type_id=2 or a.dslam_type_id=3 or a.dslam_type_id=7 or a.dslam_type_id=8 ) ORDER BY b.system_id,b.cong";
            var odr = BaseClass.Lib_GetDataReader(sql);
            foreach (DataRow item in odr.Rows)
            {
                DslamPort.Add(new xuatdulieuModel
                {
                    cong = item["cong"].ToString(),
                    mathietbi = item["system_id"].ToString(),
                    slot = item["slot"].ToString(),
                    port = item["port"].ToString(),
                    vpi = item["vpi"].ToString(),
                    vci = item["vci"].ToString(),
                    trangthai = item["status"].ToString(),
                    accinternet = item["account_int"].ToString(),
                    accmytv = item["account_mytv"].ToString(),
                });

            }
            
            BaseClass.conn_global.Close();
            return DslamPort;
        
        }
    }


}
